<script>   
 // 计算传入数据的平均值   
 function avg(...values) {   
   let sum = 0;   
   for (var val of values) {     
 sum += val;   
   }   
   return sum / values.length;   
 }   
  let result = avg(1, 2, 3)    
  console.log(result); //  2   
</script> 